<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            display: flex;
            
        }
        textarea{
            flex: 1;
            height: 650px;
            background:url('https://img2.baidu.com/it/u=1929816932,1492385297&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=889') 100%/100% no-repeat ;
        }
        div{
            flex: 1;
            background-color: rgba(0, 0, 0, .1);
        }
    </style>
</head>
<body>
    <div id="box">
        <textarea v-model="val" @input="shake"></textarea>

        <div v-html="mark"></div>

    </div>

    <script src="http://chst.vip:8081/vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/marked/1.2.7/marked.min.js"></script>
    <script>
        // function anti_shake(fn,t){
        //     let timer = null
        //     return function(e){
        //         if (timer) {
        //             clearTimeout(timer)
        //         }
            
        //         timer = set(()=>{
        //            if (fn) {
        //             fn = fn.apply(this)
        //             fn(e)
        //            }
        //         },t)
        //     }
        // }


        let vm = new Vue({
            el:'#box',
            data:{
                val : '# 一级大标题'
            },
            computed: {
                mark(){
                        return marked(this.val)  
                }
            }
            // methods: {
            //     shake(){
            //         anti_shake(function(e){
            //             console.log(e);
            //             this.val = e.target.value
            //         },1000)
            // }
            // }
        })


    </script>
</body>
</html>